package com.example.hssmgs.Student;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class DBOpenHelper extends SQLiteOpenHelper {

    public DBOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // 创建学生信息表语句
        String sql_student_db = "create table student_db(account int, id int)";
        // 学生密码表
        String sql_student_pw = "create table student_pw(account int, password varchar(20))";



        db.execSQL(sql_student_db);
        db.execSQL(sql_student_pw);

        String sql_insert_pw1 = "insert into student_pw values (1, 'yz'), (2, 'haha')";
        String sql_insert_db1 = "insert into student_db values (1, 19990712)";


        db.execSQL(sql_insert_pw1);
        db.execSQL(sql_insert_db1);


        // 创建老师表语句
//        String sql_teacher_db = "create table student_db("+
//                "id int)";


    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
